package main

import (
	"context"
	"github.com/SkyAPM/go2sky"
	"github.com/SkyAPM/go2sky/reporter"
	"log"
)

func main() {
	r, err := reporter.NewGRPCReporter("127.0.0.1:11800")
	if err != nil {
		log.Fatalf("new reporter error %v \n", err)
	}
	defer r.Close()
	tracer, err := go2sky.NewTracer("example", go2sky.WithReporter(r))

	span, ctx, err := tracer.CreateLocalSpan(context.Background())
	subSpan, _, err := tracer.CreateLocalSpan(ctx)

	subSpan.End() //调用End方法触发上报
	span.End()
}
